add a button to open the browser if TOS need to be signed
authorJyrki Gadinger <nilsding@nilsding.org>
Tue, 18 Feb 2025 10:53:38 +0000 (11:53 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 20 Feb 2025 11:00:55 +0000 (12:00 +0100)
Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
src/gui/tray/SyncStatus.qml
src/gui/tray/usermodel.cpp
src/gui/tray/usermodel.h

index b482c5586dab79e82da2d50c152da379352eadf7..fa106f96ccf2f9290beb3d5ad019ae26fd867bb6 100644 (file)
@@ -119,4 +119,15 @@ RowLayout {
         enabled: visible
         onClicked: NC.Systray.createResolveConflictsDialog(activityModel.allConflicts);
     }
+
+    Button {
+        Layout.rightMargin: Style.trayHorizontalMargin
+
+        text: qsTr("Open browser")
+
+        visible: NC.UserModel.currentUser.needsToSignTermsOfService
+        enabled: visible
+
+        onClicked: NC.UserModel.openCurrentAccountServer()
+    }
 }
index b24ae990df3385e86e2e8c8b624cb995aea5ae05..01260f275c1de805ba3cf9387bd1ab5c1ff073d2 100644 (file)
@@ -1130,6 +1130,11 @@ bool User::isConnected() const
     return (_account->connectionStatus() == AccountState::ConnectionStatus::Connected);
 }
 
+bool User::needsToSignTermsOfService() const
+{
+    return _account->connectionStatus() == AccountState::ConnectionStatus::NeedToSignTermsOfService;
+}
+
 
 bool User::isDesktopNotificationsAllowed() const
 {
index 3f2170ab0748eced506a9b0d1761e560326f7c56..2d56f0121059521164781cea111ee3dc477ca46d 100644 (file)
@@ -61,6 +61,7 @@ class User : public QObject
     Q_PROPERTY(QString featuredAppAccessibleName READ featuredAppAccessibleName NOTIFY featuredAppChanged)
     Q_PROPERTY(QString avatar READ avatarUrl NOTIFY avatarChanged)
     Q_PROPERTY(bool isConnected READ isConnected NOTIFY accountStateChanged)
+    Q_PROPERTY(bool needsToSignTermsOfService READ needsToSignTermsOfService NOTIFY accountStateChanged)
     Q_PROPERTY(UnifiedSearchResultsListModel* unifiedSearchResultsListModel READ getUnifiedSearchResultsListModel CONSTANT)
     Q_PROPERTY(QVariantList groupFolders READ groupFolders NOTIFY groupFoldersChanged)
 
@@ -71,6 +72,7 @@ public:
     [[nodiscard]] AccountStatePtr accountState() const;
 
     [[nodiscard]] bool isConnected() const;
+    [[nodiscard]] bool needsToSignTermsOfService() const;
     [[nodiscard]] bool isCurrentUser() const;
     void setCurrentUser(const bool &isCurrent);
     [[nodiscard]] Folder *getFolder() const;